let id = localStorage.getItem("cpid");
$.ajax({
  url: "/recipeInfo/" + id,
  method: "get",
  success(res) {
    console.log(res);
    let str = `
    <h3>${res.data.title}</h3>
    <p>${res.data.author}</p>
`;
    $(".title-box").html(str);
    let str1 = `
  <img class="show-img" src="http://124.223.14.236:3001/public/food/info-${res.data.id}.jpg" alt="" />
<blockquote>
    <span
        class="txt_tart">“</span>${res.data.description}<span
        class="txt_end">”
</blockquote>

`;
    $(".box").html(str1);
    // 主材
    let zhuliao = JSON.parse(res.data["raw_list"]);
    // console.log(zhuliao);
    let str2 = zhuliao.map(
      (item) => `
      <li>
           <span class="category_s1">
            <a href="/YuanLiao/ZhongJinMianFen/" title="面粉的做法" target="_blank"><b>${item.name}</b></a}</b></a>
            </span>
            <span class="category_s2">${item.num}</span>
      </li>
    `
    );
    $(".one").html(str2.join(""));
    let fuLiao = JSON.parse(res.data["raw_fu_list"]);
    let str3 = fuLiao
      .map(function (item, i) {
        return `
    <li>
              <span class="category_s1">
                <a href="/YuanLiao/ZhongJinMianFen/" title="面粉的做法" target="_blank"><b>${item.name}</b></a}</b></a>
              </span>
              <span class="category_s2">${item.num}</span>
            </li>
    `;
      })
      .join("");
    $(".two ul").html(str3);
    //调料
    let tiaoLiao = JSON.parse(res.data["raw_tl_list"]);
    let str4 = tiaoLiao
      .map(function (item, i) {
        return `
    <li>
              <span class="category_s1">
                <a href="/YuanLiao/ZhongJinMianFen/" title="面粉的做法" target="_blank"><b>${item.name}</b></a}</b></a>
              </span>
              <span class="category_s2">${item.num}</span>
            </li>
    `;
      })
      .join("");
    $(".three ul").html(str4);
    let str5 = `
  <h3>${res.data.title}的做法步骤</h3>
  `;
    $(".mo").html(str5);
    //步骤
    let str6 = res.data.context;
    $(".recipeStep").html(str6);
  },
});
